1. Field of the Invention
This invention relates to a method for reducing the size of computer programs, in particular, to a method of reducing the size of compiled and executable computer programs which are edited with the aid of object-oriented programming techniques. The invention is particularly applicable to the technical field of producing class libraries for an object-oriented programming language.
2. Description of the Related Art
Because of their specific advantages, object-oriented programming techniques are well entrenched in the development of computer programs. In particular, the reusability of source code with which the object-oriented programming techniques are produced is a decisive factor in the use of these programming techniques.
In object-oriented programming the source code is structured not according to function but according to data; for this, special data structures are employed, the so-called objects A typical representative of the object-oriented programming languages is the programming language known as C++. Here the objects can be taken from so-called classes or, expressed in technical language, instantiated The objects receive certain functionalities from the classes from which they are instantiated and are specified by means of additional data fields through the process of instantiating.
An introduction to the technology of object-oriented programming techniques and to an explanation of the relevant terminology is provided in G Booch, Object-Oriented Analysis and Design with Applications, Benjamin/Cummings Publishing, 2nd Edition, 1994.
C++ is presented and described, for example, in A. Koenig, Programming Language C++, ANSI Committee, WG21/No545, 1994 and in B. Stroustrup, The C++ Programming Language, 2nd Edition, AT&T Bell Telephone Laboratories, 1991.
The object-oriented programming technique frequently requires structuring of the classes with hierarchical links. This leads to the design of a class hierarchy The individual classes of the class hierarchy can exhibit so-called virtual functions which can be passed to all derived classes and the functional range of which can be more closely defined by an implementation in the derived classes. When a class exhibits at least one such virtual function, one talks of an abstract class or rather of an abstract class hierarchy This abstraction on the basis of virtual functions allows the polymorph use of the hierarchically linked classes, that is, through the abstract view of an object it is possible to describe any desired object of any desired derived class.
In addition to the class hierarchy, a parameterizing of the class hierarchy by means of one or more data types is often required to enable a rigidly typed and at the same time flexible instance of the class hierarchy. For example element types such as STRING or INTEGER are transferred as arguments for the formal parameters of a parameterized class or a parameterized class hierarchy For this purpose generic types, so-called templates, are used. In C++, the above-mentioned instances are realized through this template mechanism.
The use of the virtual functions with their associated polymorph form of the classes and the use of parameterized template classes leads to a marked increase in the size of the executable computer program in accordance with the abbreviated formula: ##EQU1##
This problem is also addressed in B. Stroustrup, The Design and Evolution of C++, AT&T Bell Telephone Laboratories 1994. The Common Code Approach, where common components of the template classes are picked out and held in a separate basic class for the relevant concrete template class, is discussed as a possible solution. As a result of this process, a class is divided into two parts: in one part, which can be considered as an interface, is the typed template class and in the other part, which can be considered as an implementation, is the untyped common code.
The known methods for reducing the size of computer programs produced with the aid of object-oriented programming techniques do not provide a satisfactory reduction of the size of the computer program. In accordance with the known methods, at least the typed template classes, and generally also the associated untyped basic classes, have virtual functions, that is, even if the size of an instance shrinks, the existence of the virtual functions leads to linearly expanding computer programs.
Because of the large size of such computer programs, just for medium and even small problems, the electronic storage and the execution of these programs demands a large expenditure on the computer systems required. Thus, for example, large and expensive storage, both working memory and mass memory, and substantial computing power must be allocated. In addition, a large computer program necessitates both a long loading time and a long execution time for the computer program.